﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

/// <summary>
/// Summary description for Hoa
/// </summary>
public class Hoa
{
	public Hoa()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    DBConnection db = new DBConnection();
    public DataTable Load_HoaMSNhat()
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh,CTLoaihoa.maloai, Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00002' ";
        return db.Get_data(sql);
    }
    public DataTable Load_HoaTY()
    {
        string sql = "select Hoa.Mahoa, giahoa,CTLoaihoa.maloai, hinhanh, Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00008'";
        return db.Get_data(sql);
    }
    public DataTable Load_HoaCuoi()
    {
        string sql = "select Hoa.Mahoa, giahoa, CTLoaihoa.maloai, hinhanh, Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00001'";
        return db.Get_data(sql);
    }
    public DataTable Load_HoaCHucmung()
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh,CTLoaihoa.maloai, Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00007'";
        return db.Get_data(sql);
    }
    public DataTable Load_HoaBo()
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh, CTLoaihoa.maloai,Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00004'";
        return db.Get_data(sql);
    }
    public DataTable Load_Gio()
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh, CTLoaihoa.maloai,Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00005'";
        return db.Get_data(sql);
    }
    public DataTable Load_HoaTrongHop()
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh, CTLoaihoa.maloai,Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00009'";
        return db.Get_data(sql);
    }
    public DataTable Load_Hoalang()
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh, CTLoaihoa.maloai,Tenloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Maloai='L00010'";
        return db.Get_data(sql);
    }
    public DataTable Load_CTHoa(string Mahoa)
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh, Tenhoa, NguonGoc, YNghia , LoaiHoa.Maloai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTloaihoa.Mahoa=@Mahoa";
        SqlParameter p1 = new SqlParameter("@Mahoa",Mahoa);
        return db.Get_data(sql,p1);
    }
    public DataTable Load_HoaCungLoai(string Maloai)
    {
        string sql = "select Hoa.Mahoa, giahoa, hinhanh, TenLoai from Hoa, loaihoa, CTLoaihoa " +
                "where Hoa.Mahoa=CTloaihoa.Mahoa and CTLoaihoa.maloai=LoaiHoa.Maloai and CTLoaihoa.maloai=@Maloai";
        SqlParameter p1 = new SqlParameter("@Maloai", Maloai);
        return db.Get_data(sql, p1);
    }
}
